package desperte.aqui;

/*
 * GmapItemizedOverlay.java
 * Purpose: Gerenciar os itens da lista de overlays
 * 
 * @author Thassio Carvalho <tvmcarvalho@gmail.com>
 * @version 1.0 19/05/2012
 * 
 */

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class GmapItemizedOverlay extends ItemizedOverlay<OverlayItem>{

	Context tcontext;
	ArrayList<OverlayItem> tOverlays = new ArrayList<OverlayItem>();
	
	/*
	 * Método contrutor
	 * 
	 * @param defaultMarker Objeto drawable que será usado para marcar o mapa 
	 * @param tcontext Contexto o qual será adicionada lista de Overlays
	 */
	public GmapItemizedOverlay(Drawable defaultMarker, Context tcontext) {
		super(defaultMarker);
		// TODO Auto-generated constructor stub
	}

	/*
	 * Método que adiciona overlays a lista tOverlays
	 * 
	 * @param overlay Overlay que será adicionado
	 */
	public void addoverlay(OverlayItem overlay){
		tOverlays.add(overlay);
		populate();
	}
	
	/*  
	 * (non-Javadoc)
	 * @see com.google.android.maps.ItemizedOverlay#createItem(int)
	 */
	@Override
	protected OverlayItem createItem(int arg0) {
		// TODO Auto-generated method stub
		return tOverlays.get(arg0);
	}

	/*
	 * (non-Javadoc)
	 * @see com.google.android.maps.ItemizedOverlay#size()
	 */
	@Override
	public int size() {
		// TODO Auto-generated method stub
		return tOverlays.size();
	}
	
}
